<?php
/**
 * Created by PhpStorm.
 * User: 38339
 * Date: 2021-05-26
 * Time: 14:58
 */

namespace app\common\business\mysql;
use app\common\model\mysql\YwProjectSubmitRecord as models;

class YwProjectSubmitRecord
{

    /*
     * 获取单条数据
     */
    public static function getOne($where){
        return models::getOne($where);
    }

    /*
     * 获取数据
     */
   public static function getList($where,$limit_start,$page_size){
       return models::getList($where,$limit_start,$page_size);
   }

   /*
    * 获取数据条数
    */
   public static function getCount($where){
       return getAllPage(models::getCount($where));
   }

   /*
    * 新增数据
    */
   public static function insert($receiveData,$admin){
       $data = [
           'remark' => $receiveData['remark'],
           'zip_str' => $receiveData['zip_str'],
           'admin_id' => $admin['id'],
           'create_time' => date('Y-m-d H:i:s')
       ];
       models::insert($data);
       //写入日志
       CommonLog::insertLog($admin['id'],'/YwProjectSubmitRecord/insert','',$data,1);
       return true;
   }

   /*
    * 修改数据
    */
   public static function edit($receiveData,$admin){
       $data = [
           'remark' => $receiveData['remark'],
           'zip_str' => $receiveData['zip_str'],
           'admin_id' => $admin['id']
       ];
       models::where(['id'=>$receiveData['id']])->update($data);
       //写入日志
       CommonLog::insertLog($admin['id'],'/YwProjectSubmitRecord/edit','',$data,2);
       return true;
   }

    /*
     * 删除数据
     */
    public static function delete($receiveData,$admin,$load){
        models::where(['id'=>$receiveData['id']])->delete();
        //写入日志
        CommonLog::insertLog($admin['id'],'/YwProjectSubmitRecord/delete',$load,'',3);
        return true;
    }

}